<template>
  <div>
    <el-card style="width: 40%; margin: 10px">
      <el-form ref="form" :model="form" label-width="80px">
       
        <el-form-item label="用户名">
          <el-input v-model="form.userAccount" disabled></el-input>
        </el-form-item>
        
        <el-form-item label="密码">
          <el-input v-model="form.passWord" show-password></el-input>
        </el-form-item>
      </el-form>
      <div style="text-align: center">
        <el-button type="primary" @click="update">保存</el-button>
      </div>
    </el-card>

  </div>
</template>



<script>
// import request from "@/utils/request";

export default {
  name: "Person",
  data() {
    return {
      form: {}
    }
  },
  created() {
    this.form.userAccount=sessionStorage.getItem("useraccount")
    this.form.passWord=sessionStorage.getItem("passWord")
    // let str = sessionStorage.getItem("useraccount") || "{}"
    // this.form = JSON.parse(str)
  },
  methods: {
    // handleAvatarSuccess(res) {
    //   this.form.avatar = res.data
    //   this.$message.success("上传成功")
    //   // this.update()
    // },

    // update() {
    //   request.put("/user", this.form).then(res => {
    //     console.log(res)
    //     if (res.code === '0') {
    //       this.$message({
    //         type: "success",
    //         message: "更新成功"
    //       })
    //       sessionStorage.setItem("user", JSON.stringify(this.form))
    //       // 触发Layout更新用户信息
    //       this.$emit("userInfo")
    //     } else {
    //       this.$message({
    //         type: "error",
    //         message: res.msg
    //       })
    //     }
    //   })
    // }
  }
}
</script>
